from oss_sdk import *

def load_prefix_list(file_path):
    prefix_list = []
    with open(file_path, 'r') as f:
        for line in f:
            prefix_list.append(line.strip())
    return prefix_list

if __name__ == '__main__':
    bucket_name = 'sanbo'
    prefix_file = 'folder_list.txt'
    prefix_list = load_prefix_list(prefix_file)
    #print(prefix_list)
    n = 0
    for prefix in prefix_list:
        n += 1
        print("Downloading folder(%d/%d): %s" % (n, len(prefix_list), prefix))
        download_oss_folder(bucket_name, prefix, 'f://download/', delete_object_flag=True)
        #if n > 100: 
        #    break